package com.lihuinch.ti4j.chap7.demo;

/**
 * 测试初始化顺序
 *
 * @author  lihuinch
 * @date 2018/1/24
 */
public class InitalOrder {

    private InitalClass shiliPlace;
    private InitalClass definePlace = new InitalClass("definePlace");

    {
        shiliPlace = new InitalClass("shiliPlace");
    }
    public InitalOrder() {
        System.out.println("Constractor");
    }

    public static void main(String[] args) {
        new InitalOrder();
    }
}

/**
 * 用来测试的被初始化类
 *
 * @author  lihuinch
 * @date 2018/1/24
 */
class InitalClass {
    public InitalClass(String name) {
        this.name = name;
        System.out.println(name);
    }

    private String name;
}